﻿using System;
using System.Text;
using LightInject;
using Mnk.Merger.Code.Commands;
using Mnk.Merger.Code.Common;
using Mnk.Merger.Code.Repository;
using Mnk.Merger.Code.UI;

namespace Mnk.Merger.Code
{
    class ServicesRegistrar
    {
        public IServiceContainer Register()
        {
            Console.OutputEncoding = Encoding.UTF8;

            var container = new ServiceContainer();
            container.Register<IRepositoryCache, RepositoryCache>(new PerContainerLifetime());
            container.Register<IRepositoryProvider, RepositoryProvider>(new PerContainerLifetime());
            container.Register<IProcessExecutor, ProcessExecutor>(new PerContainerLifetime());
            container.Register<IRepositoryFacade, RepositoryFacade>(new PerContainerLifetime());
            container.Register<ISerializer, Serializer>(new PerContainerLifetime());
            container.Register<IJsonDataSerializer, JsonDataSerializer>(new PerContainerLifetime());
            container.Register<IMergePathsBuilder, MergePathsBuilder>(new PerContainerLifetime());
            container.Register<IMergeSpy, MergeSpy>(new PerContainerLifetime());
            container.Register<IMerger, Commands.Merger>(new PerContainerLifetime());
            container.Register<IBulkOperations, BulkOperations>(new PerContainerLifetime());
            container.Register<IMergeUi, MergeUi>(new PerContainerLifetime());
            container.Register<ISpyUi, SpyUi>(new PerContainerLifetime());
            return container;
        }
    }
}
